namespace PickGold.Charting
{
    using System;
    using System.Collections;
    using System.ComponentModel;

    internal class SeriesAreaNameConverter : StringConverter
    {
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList values = new ArrayList();
            Chart chartFromContext = ConverterHelper.GetChartFromContext(context);
            if (chartFromContext != null)
            {
                foreach (ChartArea area in chartFromContext.ChartAreas)
                {
                    values.Add(area.Name);
                }
            }
            return new TypeConverter.StandardValuesCollection(values);
        }

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            return false;
        }

        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }
    }
}

